<?php
namespace plugins\finance\controller;

use cmf\controller\PluginAdminBaseController;
use think\Db;
use think\Request;
use app\common\lib\model_operate\Transit;


//充值
class RechargeController extends PluginAdminBaseController
{
	//充值列表
	public function index()
	{
		$param = $this->request->param();

		//权限检测 
		$check = ( new \plugins\store\Common )->getAllowAccess();
		if($check === true){
			//后台
			$where = ['finance_type'=>'admin','finance_type_id'=>'admin'];
		}else{
			//店铺
			$where = ['finance_type'=>'store','finance_type_id'=>$check];
		}
		//充值记录
		$search =  Transit::createTags('search');
		$search->setParam($param);
		$table = Transit::createTags('table');
		$table->setParam($search);	
		$pagesize = isset( $param [ 'pagesize' ] ) ? $param [ 'pagesize' ] : 20;

		$param['order_status'] = isset($param['order_status']) ? $param['order_status'] : "";

		$sear = [
			"order_status"=>$param['order_status']
		];
		$sear = [];

		$list = $table->query()
		->order('id desc')
		->paginates($pagesize,false,['query'=>$sear]);

		$this->assign('search',$search);
		$this->assign('table',$table);
		$this->assign('list',$list);

		return $this->fetch();
	}
}